//
//  Peers.h
//  SolarSeek
//
//  Created by Erick Fejta on 05/01/17.
//  Copyright 2005 Erick Fejta. All rights reserved.
//

#import <Cocoa/Cocoa.h>

#import "EnumTypes.h"
#import "SolarSeekAddress.h"

@class SharePeer;
@class ShareTree;
@class Share;
@class ShareLocal;

extern const unsigned PeerPrivilegesDonated; //people donating to Soulseek
extern const unsigned PeerPrivilegesSSDonated; //people donating to SolarSeek
extern const unsigned PeerPrivilegesSS; //people using SolarSeek
extern const unsigned PeerPrivilegesFriend; //your friends
extern const unsigned PeerPrivilegesBestFriend; //your closest friends	
extern const unsigned PeerPrivilegesAssociate; //someone you know a bit
extern const unsigned PeerPrivilegesUploaded; //someone who has sent info
extern const unsigned PeerPrivilegesNotAnnoying; //anyone who isn't annoying.
extern const unsigned PeerPrivilegesTalked; //someone who said something.


@interface Peer : NSObject <NSCoding> {
	BOOL exists;
	unsigned token;

	ShareTree *sharesTree;

	NSString *name;
	unsigned privileges;
	Availability availability;
	unsigned speedAverage;
	unsigned countFiles;
	unsigned countFolders;
	unsigned countSlotsAvailable;
	unsigned countSlotsTotal;
	unsigned countDownloadsQueued;
	NSString *comment;
	NSData *picture;
	NSImage *iconBuffer;
	NSString *note;
	SolarSeekAddress *address;
}

- (id)initWithName:(NSString *)n;
- (BOOL)isEqual:(id)obj;


- (void)setAddress:(SolarSeekAddress *)address;
- (void)setAvailability:(Availability)a;
- (void)setComment:(NSString *)c;
- (void)setExists:(BOOL)e;
- (void)setNote:(NSString *)note;
- (void)setPicture:(NSData *)data;

- (SolarSeekAddress *)address;
- (Availability)availability;
- (NSString *)comment;
- (BOOL)exists;
- (NSImage *)icon;
- (unsigned)token;
- (NSString *)name;
- (NSString *)note;
- (NSData *)picture;
- (unsigned)privileges;
- (NSComparisonResult)compare:(Peer *)other;
- (unsigned)countFiles;
- (unsigned)countFolders;

- (void)addPrivileges:(unsigned)privs;
- (void)removePrivileges:(unsigned)privs;

- (void)removeAllShares;
//- (void)removeShares:(id)shares;
//- (void)removeShare;
- (ShareTree *)sharesTreeRoot;

+ (NSMutableSet *)peersInCollection:(id)collection;	//will run [object peer] on each object in the collection.

@end
